import {
	defineStore
} from "pinia"
import overallRequest from "@/utool/http/http.js"
export default defineStore('Manage', {
	state: () => ({
		PageCurrent: 0,
		Tabs: {
			show: false,
			current: 0,
			list: [{
					key: '1',
					value: '数据台'
				},
				{
					key: '2',
					value: '管理'
				}
			],
		},
		dataGetStatus: false,
		Manage: {
			initData: false,
		},
		// Banner 轮播图
		Banner: {},
		Options: {
			list: []
		},
		Operation: {
			list: []
		},
		Notice: {},
		System: {},
		SMS: {},
		Request: {}
	}),
	actions: {
		PageChangeUpdate: async function(index) {
			index = Number(index)
			this.Tabs.current = index
		},
		GetManageList:async function (){
			let url = "/Manage/Observe"
			overallRequest(url)
		},
		GetData: async function() {
			let url = "/Manage/Observe"
			overallRequest(url).then(res => {
				let {
					data
				} = res
				let {
					SMS,
					Request,
					System,
					Notice,
					Manage,
					optionsList,
					Banner,
					list
				} = data
				this.SMS = SMS
				this.Request = Request
				this.System = System
				this.Notice = Notice
				this.Manage = Manage
				this.Banner = Banner
				this.Operation.list = list
				this.Options.list = optionsList
				this.dataGetStatus = true
			})
		}
	}

})